<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>for循环语句</title>
</head>
<body>
<script type="text/javascript">
	var sum = 0                            //定义变量sum，用于记住累加的和
	for(var i = 1; i < 100; i+=2){         //i的值以加2的方式自增
		sum=sum+i;                         //实现sum与i的累加
	}
	alert("100以内所有奇数和："+sum);         //输出计算结果
</script>
</body>
</html>
